package com.kingyun.gpsinspection.purificationservice.services.jsm.outerservice.impl;

import com.kingyun.gpsinspection.purificationservice.facade.model.jsm.Organization;
import com.kingyun.gpsinspection.purificationservice.facade.model.jsm.Ztree;
import com.kingyun.gpsinspection.purificationservice.facade.service.jsm.OutDepartmentService;
import com.kingyun.gpsinspection.purificationservice.facade.service.jsm.department.JsmDepartmentService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * Created by YuPeng on 2016/11/30.
 * 部门查询公用实现
 */

public class OutDepartmentServiceImpl implements OutDepartmentService {
    @Autowired
    private JsmDepartmentService deptService;

    /**
     * 根据组织机构ID 查询组织机构下的部门
     * @param orgId
     */
    @Override
    public List<Ztree> queryDeptTree(String orgId) throws Exception {
        return deptService.queryDeptByOrgId(orgId);
    }

    /**
     * 获取部门树
     * @param isOrg
     * @param Id
     */



    @Override
    public List<Ztree> queryDeptTree(String isOrg, String Id,String keyword) throws Exception {
        return deptService.queryDeptTree(isOrg, Id,keyword);
    }

    /**
     * 按上级机构ID获取前部门树
     *
     * @param orgId
     * @return
     * @throws Exception
     */
    @Override
    public List<Ztree> queryDeptTreeByPOId(String orgId) throws Exception {
        return deptService.queryDeptTreeByPOId(orgId, 0);
    }

    /**
     * 按上级部门ID获取部门树
     *
     * @param deptId
     * @return
     * @throws Exception
     */
    @Override
    public List<Ztree> queryDeptTreeByPDId(String deptId) throws Exception {
        return deptService.queryDeptTreeByPDId(deptId);
    }

    /**
     * 获取部门或机构的上级管理机构
     *
     * @param id 机构或部门的ID
     * @return
     * @throws Exception
     */
    public Organization getParentOrg(String id) throws Exception {
        return deptService.getParentOrg(id);
    }

    public JsmDepartmentService getDeptService() {
        return deptService;
    }

    public void setDeptService(JsmDepartmentService deptService) {
        this.deptService = deptService;
    }
}
